// 商品品牌管理的接口

import request from "@/utils/request";
import type { trademarkModel, trademarkpageListModel, trademarksModel } from "./model/trademarkModel";

enum Api {
  // GET /admin/product/baseTrademark/{page}/{limit} 分页列表
  trademarkpageList = "/admin/product/baseTrademark",

  // POST /admin/product/baseTrademark/save 新增品牌
  savetrademark = "/admin/product/baseTrademark/save",

  // PUT /admin/product/baseTrademark/update 修改品牌
  updatetrademark = "/admin/product/baseTrademark/update",

  // DELETE /admin/product/baseTrademark/remove/{id}  删除品牌
  removetrademark = "/admin/product/baseTrademark/remove",

  // GET /admin/product/baseTrademark/getTrademarkList
  getAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList"
}


// 获取所有品牌的列表
export const getAllTrademarkListApi = () => {
  return request.get<any, trademarksModel>(Api.getAllTrademarkList,);
};

// 分页列表
export const trademarkpageListApi = (page: number, limit: number) => {
  return request.get<any, trademarkpageListModel>(Api.trademarkpageList + `/${page}/${limit}`);
};

// 新增品牌
export const savetrademarkApi = (tmName: string, logoUrl: string) => {
  return request.post(Api.savetrademark, { tmName, logoUrl });
};
export const savetrademarkApi2 = (trademark: trademarkModel) => {
  return request.post(Api.savetrademark, { trademark });
};

// 修改品牌
export const updatetrademarkApi = (trademark: trademarkModel) => {
  return request.put(Api.updatetrademark, trademark);
};
// 删除品牌
export const removetrademarkApi = (id: number) => {
  return request.delete(Api.removetrademark + `/${id}`);
};